<?php
	require_once("pre.php");
	require_once("auth.php");

	if(! est_autorise("acces_configuration")) exit;

	require_once("../fonctions/divers.php");
	require_once("../classes/Zone.class.php");
	require_once("../classes/Transzone.class.php");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require_once("title.php");?>
<script src="../lib/jquery/jquery.js" type="text/javascript"></script>
<?php require_once("js/transport.php"); ?>
</head>

<body>
<div id="wrapper">
<div id="subwrapper">

<?php
	$menu="configuration";
	require_once("entete.php");
?>

<div id="contenu_int">
    <p><a href="accueil.php" class="lien04"><?php echo trad('Accueil'); ?> </a><img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="configuration.php" class="lien04"> <?php echo trad('Configuration'); ?></a> <img src="gfx/suivant.gif" width="12" height="9" border="0" /> <a href="#" class="lien04"><?php echo trad('Gestion_transports'); ?></a></p>

<!-- Début de la colonne de gauche -->
<div id="bloc_description">
	<div class="bordure_bottom">
<!-- bloc des listes de transports -->
		<div class="entete_liste_config">
			<div class="titre"><?php echo trad('LISTE_TRANSPORTS'); ?></div>
		</div>

<?php
	$liste = ActionsAdminModules::instance()->lister(2, true);

	$i = 0;

	foreach($liste as $module) {

		$fond ="ligne_".($i%2 ? 'fonce' : 'claire')."_BlocDescription";
?>

		<ul class="<?php echo $fond; ?>">
			<li style="width:534px;"><?php echo ActionsAdminModules::instance()->lire_titre_module($module); ?></li>
			<li style="width:32px;"><a href="transport.php?id=<?php echo $module->id; ?>#lzone"><?php echo trad('editer'); ?></a></li>
		</ul>
<?php
		$i++;
	}
?>
</div>
	<!-- fin du bloc des listes de transports -->

<?php
	if($_GET['id']){
		$transzone = new Transzone();
		$zone = new Zone();
		$tr = new Modules();
		$tr->charger_id($_GET['id']);

?>
<a name="lzone">&nbsp;</a>
	<div class="bordure_bottom" id="listezone">
		<div class="entete_liste_config" style="margin-top:15px;">
			<div class="titre"><?php echo trad('MODIFICATION_TRANSPORT'); ?> <?php echo strtoupper(ActionsAdminModules::instance()->lire_titre_module($module)); ?></div>
		</div>
		<ul class="ligne1">
			<li style="width:250px;">
				<select class="form_select" id="zone">
				<?php
					$query = "select * from $zone->table";
					$resul = mysql_query($query, $transzone->link);
					while($row = mysql_fetch_object($resul)){
						$test = new Transzone();
						if(! $test->charger($_GET['id'], $row->id)){
				?>
		     	<option value="<?php echo $row->id; ?>"><?php echo $row->nom; ?></option>
		     	<?php
		     			}
		     		}
		     	?>
				</select>
			</li>
			<li><a href="javascript:ajouter($('#zone').val())"><?php echo trad('AJOUTER_ZONE'); ?></a></li>
		</ul>

<?php
		$query = "select * from $transzone->table where transport=\"" . $_GET['id']. "\"";
		$resul = mysql_query($query, $transzone->link);

		$i = 0;

		while($row = mysql_fetch_object($resul)){
			$zone = new Zone();
			$zone->charger($row->zone);


			$fond ="ligne_".($i%2 ? 'fonce' : 'claire')."_BlocDescription";

?>
		<ul class="<?php echo $fond; ?>">
				<li style="width:505px;"><?php echo $zone->nom; ?></li>
				<li style="width:32px;"><a href="javascript:supprimer(<?php echo $row->id; ?>)"><?php echo trad('Supprimer'); ?></a></li>
		</ul>
<?php

		$i++;
	}
?>
</div>

<?php
	}
?>

</div>
<!-- fin du bloc description -->
</div>
<?php require_once("pied.php");?>
</div>
</div>
</body>
</html>
